package jeju.daum.controller;

import jeju.daum.model.User;
import jeju.daum.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping(value="/joinuser")
public class JoinUserController {
	
	@Autowired UserService userService;
	
	@RequestMapping(method=RequestMethod.GET)
	public String showForm(){
		return "joinuser";
	}
	
	@RequestMapping(method=RequestMethod.POST)
	public String save(@ModelAttribute("user") User user){
		
		userService.saveUser(user);
		return "redirect:/comment";
	}
}